function infoType(pid){
	$.ajax({
		url:Server + "/front/info/infoType",
		type:"POST",
		data:{
			"pid" : pid
		},
		success : function(data){
			var html = "<option value = '0' >全部</option>";
			for(var i in data){
				var type = data[i];
				html += "<option value = '"+ type.id +"'>" + type.name + "</option>";
			}
			if(pid == 0){
				$("#type1").html(html);
			}else{
				$("#type2").html(html);
			}
		},
		error : function(msg) {}
		
		
	});
}


function save(){
	$.ajax({
		url:Server + "/front/info/addInfo",
		type:"Post",
		data:$('#signupForm').serialize(),
		success : function(data){
			alert("添加成功");
			$(location).attr('href', "publishInstrument17");
		},
		error : function(msg) {
			alert("添加失败");
			}
		});
}

function findInfoById(id){
	$.ajax({
		url:Server + "/front/order/findInsinfo",
		type:"Post",
		data:{
			"id" : id
		},
		success:function(data){
			console.log(JSON.stringify(data))
			var commentList = data[0].commentList;
			var comment = "";
			$("#tille").html(data.chineseName);
			$("#chineseName").html(data[0].chineseName);
			$("#englishName").html(data[0].englishName);
			$("#model").html(data[0].model);
			$("#address").html(data[0].address);
			$("#make").html(data[0].make);
			$("#price").html(data[0].price);
			$("#infoId").val(data[0].id);
			$("#count").html("用户评价("+commentList.length+")");
			for(var i = 0; i < commentList.length; i++){
				comment += '<li>\
					<div class="fontInfo">\
				<div class="left">"'+commentList[i].content+'"</div>\
				<div class="right">\
					一日***记忆<span>（匿名）</span>\
				</div>\
			</div>\
			<div class="pic">\
				<img src="images/productDetailPic.png" /> <img\
					src="images/productDetailPic.png" />\
			</div>\
			<div class="replay">\
				<div class="left">\
					回复：<span>"'+commentList[i].reply+'"</span>\
				</div>\
				<div class="right">负责人：张三</div>\
			</div>\
		</li>';
			}
			$("#comment").html(comment);
		},
		error:function(msg){
			alert("加载失败!!!");
		}
	});
}


function getHsonLength(json){  
    var jsonLength=0;  
    for (var i in json) {  
        jsonLength++;  
    }  
    return jsonLength;  
}  